$(document).ready(function(){
	$("#newadminBtn").click(function(){
		var username = $("#username").val();
		var phonenumb = $("#phonenumb").val();
		var idcardnumb = $("#idcardnumb").val();
		var sex = $('input:radio[name="sex"]:checked').val();
		$.ajax({
			"type":"post",
			"url":"../RegisterServlet?method=NewAdmin",
			"data":{
				"username":username,
				"phonenumb":phonenumb,
				"idcardnumb":idcardnumb,
				"sex":sex
			},
			success:function(data){
				var info = JSON.parse(data).info;
				$("#resultinfo").text(info);
		    	window.setTimeout(function(){
		    		$.blockUI({
		    			message:$('#noresult'),
		    			css: {
		    				padding:"20px",
		                    border: "1px",                   // 无边界
		                    width:"1000px",                     // 中间框框的宽度
		                    top:"40%",                        // 高居中
		                    left:"20%"                        // 左居中
		               },
		    		});
		    	},100);
		    	$("#res_confirm").click(function(){
		    		 $.unblockUI();
		    	});
				reset();
			},
			error:function(){
				console.log("error");
			}
		})
		
		
	})
	
})

function reset(){
	
	var username = document.getElementById("username");
	username.value="";
	var phonenumb = document.getElementById("phonenumb");
	phonenumb.value="";
	var idcardnumb = document.getElementById("idcardnumb");
	idcardnumb.value="";
}



